<?php
include_once 'mobilecommon.php';
echo gmtime();
echo date('Z');
?>
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head>
<style>
textarea {
	width: 100%;
	overflow: auto;
	word-break: break-all;
}
ul{
	margin:0;
	padding:0;
}
li {
	margin: 50px 0px 50px 0px;
	padding:0;
	list-style-type:none;
}
#listdiv a{
width:228px;float:left;line-height:18px;height:38px;padding:5px; margin:10px;border:1px dotted #666666;background:#EEEEEE;
}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script>
function format(txt,compress/*是否为压缩模式*/){/* 格式化JSON源码(对象转换为JSON文本) */  
    var indentChar = '    ';   
    if(/^\s*$/.test(txt)){   
        alert('数据为空,无法格式化! ');   
        return;   
    }   
    try{var data=eval('('+txt+')');}   
    catch(e){   
        alert('数据源语法错误,格式化失败! 错误信息: '+e.description,'err');   
        return;   
    };   
    var draw=[],last=false,This=this,line=compress?'':'\n',nodeCount=0,maxDepth=0;   
       
    var notify=function(name,value,isLast,indent/*缩进*/,formObj){   
        nodeCount++;/*节点计数*/  
        for (var i=0,tab='';i<indent;i++ )tab+=indentChar;/* 缩进HTML */  
        tab=compress?'':tab;/*压缩模式忽略缩进*/  
        maxDepth=++indent;/*缩进递增并记录*/  
        if(value&&value.constructor==Array){/*处理数组*/  
            draw.push(tab+(formObj?('"'+name+'":'):'')+'['+line);/*缩进'[' 然后换行*/  
            for (var i=0;i<value.length;i++)   
                notify(i,value[i],i==value.length-1,indent,false);   
            draw.push(tab+']'+(isLast?line:(','+line)));/*缩进']'换行,若非尾元素则添加逗号*/  
        }else   if(value&&typeof value=='object'){/*处理对象*/  
                draw.push(tab+(formObj?('"'+name+'":'):'')+'{'+line);/*缩进'{' 然后换行*/  
                var len=0,i=0;   
                for(var key in value)len++;   
                for(var key in value)notify(key,value[key],++i==len,indent,true);   
                draw.push(tab+'}'+(isLast?line:(','+line)));/*缩进'}'换行,若非尾元素则添加逗号*/  
            }else{   
                    if(typeof value=='string')value='"'+value+'"';   
                    draw.push(tab+(formObj?('"'+name+'":'):'')+value+(isLast?'':',')+line);   
            };   
    };   
    var isLast=true,indent=0;   
    notify('',data,isLast,indent,false);   
    return draw.join('');   
}  
function servicesubmit(sender){
	$("#p").val($("#"+sender).val());
	if($("#methodtype").attr('checked')){
		$("#formid").attr("method","post").attr("target","_blank");
	}
	else{
		$("#formid").attr("method","post").attr("target","_self");
	}
}
function farea(sender){
	try{
		var a=format($("#"+sender).val());
		if(a!=undefined && a!=null && a!="")
		$("#"+sender).val(a);
		$("textarea").each(function(){ $(this).css("height",$(this).attr("scrollHeight")); });
	}
	catch(exp){
		alert(exp.message);
	}
}
function getlist(){
	$("li").each(function(){
		$("#listdiv").append("<a href=#"+$(this).find("textarea").attr("id")+" >"+$(this).find("button")[0].innerHTML+$(this).find("textarea").attr("id")+"</a>");
		});
}
$(function(){
	getlist();
});
</script>
<div style="width:100%;overfloat:auto;word-break:break-all;"><?php echo $_POST["r"]?></div>
<button type="button" onclick="farea('resulttext');">格式化</button>
<br />
<textarea
	style="border: 1px solid #DEDEDE; word-break: break-all; padding: 5px;" 
	id="resulttext"></textarea>
<form id="formid" action="ServiceService.php?XDEBUG_SESSION_START=ECLIPSE_DBGP"
	method="post" enctype="multipart/form-data"><input type="hidden" id="p" name="p" /><input type="hidden" id="alert" value="alert" name="alert" /> <input
	type="hidden" name="returnurl" value="ServiceMechanismTest.php" /> <label><input
	type="radio" name="result" value="alert"
	<?php if(!empty($_POST["result"])){ ?> checked <?php }?> />不加密</label>
	<label><input type="radio" name="result" value=""
	<?php if(empty($_POST["result"])){ ?> checked <?php }?> />加密</label>
	<label><input type="radio" id="methodtype" value="post" />Post</label>
	<div id="listdiv">
	</div>
<ul>
	<li>
		<textarea id="serviceinfo">{"op":"serviceinfo","store_id":"2","rnd":"ffffffff-84d8-2a24-374e-90a70033c587","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
		<br />
		<button type="submit" onclick="servicesubmit('serviceinfo');">服务机构信息</button>
		<button type="button" onclick="farea('serviceinfo');">格式化</button>
		<br />
	</li>
	<li>
		<textarea id="servicedescription">{"op":"servicedescription","store_id":"2","rnd":"ffffffff-84d8-2a24-374e-90a70033c587","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
		<br />
		<button type="submit" onclick="servicesubmit('servicedescription');">服务机构说明信息</button>
		<button type="button" onclick="farea('servicedescription');">格式化</button>
		<br />
	</li>
	
	<li>
		<textarea id="storecommentlist">{"op":"storecommentlist","store_id":"2","row":0,"size":10,"rnd":"ffffffff-84d8-2a24-374e-90a70033c587","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
		<br />
		<button type="submit" onclick="servicesubmit('storecommentlist');">服务机构评论列表</button>
		<button type="button" onclick="farea('storecommentlist');">格式化</button>
		<br />
	</li>
	
	<li>
		<textarea id="storecomment">{"op":"storecomment","store_id":"2","star":"5.0","content":"带狗狗来洗澡，顺便把之前的刷毛用了，服务非常好！","pic":"http://www.jobbole.com/wp-content/uploads/2015/08/ffb9db196b80c89101188363363281f6.png,http://www.jobbole.com/wp-content/uploads/2015/08/ffb9db196b80c89101188363363281f6.png","rnd":"ffffffff-84d8-2a24-374e-90a70033c587","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
		<br />
		<button type="submit" onclick="servicesubmit('storecomment');">服务机构评论</button>
		<button type="button" onclick="farea('storecomment');">格式化</button>
		<br />
	</li>
	
	<li>
		<textarea id="storecoupon">{"op":"storecoupon","store_id":"2","couponid":1,"rnd":"ffffffff-84d8-2a24-374e-90a70033c587","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
		<br />
		<button type="submit" onclick="servicesubmit('storecoupon');">优惠券详情</button>
		<button type="button" onclick="farea('storecoupon');">格式化</button>
		<br />
	</li>
	
	<li>
		<textarea id="storecouponget">{"op":"storecouponget","store_id":"2","couponid":1,"rnd":"ffffffff-84d8-2a24-374e-90a70033c587","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
		<br />
		<button type="submit" onclick="servicesubmit('storecouponget');">优惠券领用</button>
		<button type="button" onclick="farea('storecouponget');">格式化</button>
		<br />
	</li>
	
	<li>
		<textarea id="storecouponmy">{"op":"storecouponmy","row":"0","size":"10","rnd":"ffffffff-84d8-2a24-374e-90a70033c587","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
		<br />
		<button type="submit" onclick="servicesubmit('storecouponmy');">我的优惠券</button>
		<button type="button" onclick="farea('storecouponmy');">格式化</button>
		<br />
	</li>
	
	<li>
		<textarea id="storecouponuse">{"op":"storecouponuse","barcode":"000000048097+1+1","rnd":"ffffffff-84d8-2a24-374e-90a70033c587","uid":1,"version":"1.0","system":"android","opdt":"yyyyMMddHHmmss"}</textarea>
		<br />
		<button type="submit" onclick="servicesubmit('storecouponuse');">优惠券使用</button>
		<button type="button" onclick="farea('storecouponuse');">格式化</button>
		<br />
	</li>
</ul>
</form>
<script>
document.getElementById("resulttext").innerHTML=(eval("'" + '<?php echo str_replace("'","\"",$_POST["result"]);?>' + "'"));
</script>
</html>
